package com.huawei.appgallery.forum.forum.fragment;

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.text.TextUtils;
import com.huawei.appgallery.forum.base.api.IJGWTabProtocol;
import com.huawei.appgallery.forum.base.card.bean.Section;
import com.huawei.appgallery.forum.base.ui.JGWTabFragment;
import com.huawei.appgallery.foundation.ui.framework.widget.NodataWarnLayout.e;
import com.huawei.hmf.annotation.FragmentDefine;
import com.huawei.secure.android.common.intent.SafeBroadcastReceiver;
import o.bqx;
import o.bqy;
import o.bsl;
import o.bun.b;
import o.bun.h;
import o.bve;
import o.bwz;
import o.cia;
import o.ll;

@FragmentDefine(alias = "ForumFollowBaseFragment", protocol = IJGWTabProtocol.class)
public class ForumFollowBaseFragment extends JGWTabFragment {
    private SafeBroadcastReceiver ﾞ = new SafeBroadcastReceiver(this) {
        final /* synthetic */ ForumFollowBaseFragment ॱ;

        {
            this.ॱ = r1;
        }

        public void onReceiveMsg(Context context, Intent intent) {
            if (intent != null) {
                String action = intent.getAction();
                if (bwz.ˎ.equals(action)) {
                    Section section = (Section) intent.getSerializableExtra("section");
                    if (section != null) {
                        this.ॱ.ˏ(section);
                    }
                } else if ("ACTION_LOCAL_BRD_FOLLOW_CHANGED".equals(action)) {
                    Object stringExtra = intent.getStringExtra("EXRRA_UID");
                    int intExtra = intent.getIntExtra("EXTRA_FOLLOW", 0);
                    if (!TextUtils.isEmpty(stringExtra)) {
                        this.ॱ.ˊ(stringExtra, intExtra);
                    }
                }
            }
        }
    };

    public void ˏ(Bundle bundle) {
        X_();
        super.ˏ(bundle);
    }

    protected void X_() {
        this.ʼ = new bsl(this, null, ((IJGWTabProtocol) this.ﹳ.ॱ()).getUri());
    }

    public void ˌॱ() {
        super.ˌॱ();
        try {
            IntentFilter intentFilter = new IntentFilter(bwz.ˎ);
            intentFilter.addAction("ACTION_LOCAL_BRD_FOLLOW_CHANGED");
            ll.ˏ(bqy.ˋ().ˏ()).ˏ(this.ﾞ, intentFilter);
        } catch (Throwable e) {
            bqx.ˊ("ForumFollowBaseFragment", "register error", e);
        }
    }

    private void ˏ(Section section) {
        if ((this.י instanceof bve) && ((bve) this.י).ˊ(section)) {
            this.י.ͺ();
        }
    }

    private void ˊ(String str, int i) {
        if ((this.י instanceof bve) && ((bve) this.י).ˎ(str, i)) {
            this.י.ͺ();
        }
    }

    public void ˋʼ() {
        super.ˋʼ();
        try {
            ll.ˏ(bqy.ˋ().ˏ()).ˋ(this.ﾞ);
        } catch (Throwable e) {
            bqx.ˊ("ForumFollowBaseFragment", "unregister error", e);
        }
    }

    public cia ˊ(Context context) {
        return new bve(context);
    }

    public int י() {
        return b.ˊ;
    }

    public int ՙ() {
        return h.ॱ;
    }

    public void ͺˏ() {
        if (this.ߴ != null) {
            this.ߴ.setWarnImage(י());
            this.ߴ.setWarnTextOne(ՙ());
            this.ߴ.setViewVisible(e.WARN_BTN, 8);
            this.ߴ.setViewVisible(e.WARN_TEXTTWO, 8);
        }
    }
}
